package com.zyp.servlet;

import com.zyp.dao.imp.StudentDaoImp;
import com.zyp.service.StudentService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "deleteServlet",urlPatterns = "/deleteServlet")
public class deleteServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        //获取到学号
        String parameter = request.getParameter("studentID");
//        System.out.println(parameter);

        //执行sql
        StudentService studentService =new StudentService();
        int in = studentService.getDeleteService(parameter);

        response.sendRedirect("http://localhost:8081/task_4module_1/delete.jsp");

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
